<%@ page import="com.xyc.mapper.OrderMapper" %>
<%@ page import="com.xyc.pojo.Order" %>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.context.support.ClassPathXmlApplicationContext" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:include page = "/test.jsp" flush = "true"/>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>hello</title>
    <link rel='stylesheet' href='css/buycar_table.css'/>
    <link rel='stylesheet' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css'>

    <script src='http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js'></script>
    <script src='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script>
    <script src='js/myCookie.js'></script>

    <script type="text/javascript">
        var count = $('#count').val();
        var priceSingle = $('#price').text();
    </script>
    <style>
        table, tr, td {
            border: 1px solid #ccc;
        }

        table {
            text-align: center;
        }

        .row1 td, .row2 td, .row_hover td, .paging_row td {
            padding: 5px 10px;
            color: #666666;
            border: 1px solid #CBD6DE;
        }

        .row2 td {
            background: #ffffff;
        }

        .row1 td {
            background: #eeeeee;
        }

        .row_hover td {
            background: #FBFACE;
            color: #000000;
        }

        a {
            text-decoration: none;
        }
    </style>
</head>
<body>
<table>
    <tr>
        <td>订单编号</td>
        <td>创建时间</td>
        <td>商品图片</td>
        <td>商品描述</td>
        <td>数量</td>
        <td>单价</td>
        <td>优惠</td>
        <td>价格</td>
        <td>操作</td>
    </tr>
    <%
        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-dao.xml");
        OrderMapper orderMapper = ctx.getBean("orderMapper", OrderMapper.class);
        List<Order> orderList = orderMapper.findOrder();
        for (int i = 0; i < orderList.size(); i++) {
            Order order = orderList.get(i);
    %>

    <tr class="row<%=i%2+1%>">
        <td><%=order.getOrder_id()%>
        </td>
        <%
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String create_time = sdf.format(order.getCreate_time());
        %>
        <td><%=create_time%>
        </td>
        <td><%=order.getPic_name()%>
        </td>
        <td><%=order.getOrder_describe()%>
        </td>
        <td><%=order.getCount()%>
        </td>
        <td><%=order.getPrice()%>
        </td>
        <td><%=order.getDiscount()%>
        </td>
        <td><%=order.getLast_price()%>
        </td>
        <td>
            <p>删除按钮</p>
        </td>
    </tr>
    <%}%>
</table>
</body>
</html>
    